package com.xunmall.executors.demo;

import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ServerLauncher {

    private static org.slf4j.Logger logger = LoggerFactory.getLogger(ServerLauncher.class);
    private static ClassPathXmlApplicationContext context;

    public static void main(String[] args) {
        logger.info("====================starting========================");
        createApplicationContext();
    }

    public static void createApplicationContext() {
        try {
            context = new ClassPathXmlApplicationContext("app.startup.xml");
            context.registerShutdownHook();

            context.start();
            logger.info("==================== startup ok!========================");
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }

        try {
            Thread.currentThread().join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
